using Microsoft.AspNetCore.Mvc;
using QiAdmin.Core;
using QiAdmin.Core.Attributes;
using QiAdmin.Core.Models;
using QiAdmin.Model.Dtos.Input;
using QiAdmin.Service.IService;

namespace QiAdmin.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TBusinessNewsTypeController : ControllerBase
    {
        readonly ITBusinessNewsTypeService _tBusinessNewsTypeService;
        public TBusinessNewsTypeController(ITBusinessNewsTypeService tBusinessNewsTypeService)
        {
            _tBusinessNewsTypeService = tBusinessNewsTypeService;
        }

        [Permission(PermissionType.Query)]
        [HttpPost]
        public ApiJsonResult GetPageList(TBusinessNewsType_IN input)
        {
            var res = _tBusinessNewsTypeService.GetPageList(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Add)]
        [HttpPost]
        public ApiJsonResult Add(TBusinessNewsType_IN input)
        {
            var res = _tBusinessNewsTypeService.Add(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Edit)]
        [HttpPost]
        public ApiJsonResult Edit(TBusinessNewsType_IN input)
        {
            var res = _tBusinessNewsTypeService.Edit(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Query)]
        [HttpPost]
        public ApiJsonResult Get(TBusinessNewsType_IN input)
        {
            var res = _tBusinessNewsTypeService.Get(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Delete)]
        [HttpPost]
        public ApiJsonResult RemoveRange(List<TBusinessNewsType_IN> input)
        {
            var res = _tBusinessNewsTypeService.RemoveRange(input);
            return ApiJsonResult.Convert(res);
        }
    }
}
